import React, { Component } from 'react'
import classnames from 'classnames'
import './02-style'
// npm install classnames

export default class App extends Component {

    state = {
        flag: true
    }

    render() {

        const h1class = classnames({
            active: this.state.flag,
            error: !this.state.flag,
            box: true
        })

        return (
            <div>
                <h1 className={h1class} onClick={() => {
                    this.setState({
                        flag: !this.state.flag
                    })
                }}>App 组件</h1>
            </div>
        )
    }
}
